package com.tools;

import com.sobte.cqp.jcq.entity.Member;
import com.warframe.entity.database.StringContentEO;
import com.warframe.entity.message.Message;
import org.hibernate.SQLQuery;
import org.hibernate.Session;

import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;

public class StringContent {
	public final static List<String> HIGHREWARD = new ArrayList<>();

	public final static Map<String, String> RIVENPROPMAP = new HashMap<>();                     //紫卡属性
	public final static Map<String, Long> CYCLETIMESTAMP = new HashMap<>();                     //时间循环
	public final static Map<String, Boolean> CYCLETIMESTATUS = new HashMap<>();                 //昼夜状态
	public final static Map<String, String> ALERTSREWARD = new HashMap<>();                     //警报奖励
	public final static List<Long> SCHEDULEDGROUP = new ArrayList<>();                          //定时播送警报的群
	public final static Queue<String> ALERTSHISTORY = new ConcurrentLinkedQueue<>();            //定时警报历史记录
	public final static Map<String, String> WELCOME = new HashMap<>();                          //欢迎词
	public final static Map<String, String> DEFAULTGROUPCARD = new HashMap<>();                 //默认群名片
	public final static Map<String, String> SORTIEINFO = new HashMap<>();                       //突击信息
	public final static Map<Long, Map<Integer, Message>> MESSAGELAYER = new HashMap<>();        //wm递进式指令MAP
	public final static Map<Long, Map<Long,Member>> GROUPMEMBERLIST = new HashMap<>();			//群成员列表
	public final static Map<Long, String> AWARDMAP = new HashMap<>();							//已抽奖成员

	public final static Long OWNER = 576686714L;

	public final static String SENDGROUP = "SENDGROUP";     //消息执行器-->消息类型-->发送群组消息
	public final static String SENDPERSON = "SENDPERSON";   //消息执行器-->消息类型-->发送私聊消息
	public final static String ACTIVITY = "1";              //消息执行器-->消息类型-->活动
	public final static String NEWJOIN = "2";               //消息执行器-->消息类型-->新群员加入
	public final static String LUCKDRAW = "3";              //消息执行器-->消息类型-->抽奖
	public final static String WARFRAMEMARKET = "4";        //消息执行器-->消息类型-->wm查询
	public final static String ALERT = "5";                 //消息执行器-->消息类型-->警报查询
	public final static String RIVENMARKET = "6";           //消息执行器-->消息类型-->紫卡查询
	public final static String CETUSTIME = "7";             //消息执行器-->消息类型-->希图斯时间
	public final static String MOD = "8";                   //消息执行器-->消息类型-->配卡推荐
	public final static String INVASION = "9";              //消息执行器-->消息类型-->入侵信息
	public final static String SORTIE = "10";               //消息执行器-->消息类型-->突击信息
	public final static String FISSURES = "11";             //消息执行器-->消息类型-->裂缝信息
	public final static String OPENACTIVITY = "12";         //消息执行器-->消息类型-->开启活动
	public final static String CLOSEACTIVITY = "13";        //消息执行器-->消息类型-->关闭活动
	public final static String LAYERCOMMAND = "LAYER";      //消息执行器-->消息类型-->递进消息

	public final static String BUY = "buy";                 //WM模块-->交易类型-->收购
	public final static String SELL = "sell";               //WM模块-->交易类型-->出售

	public final static String ONLINE = "online";
	public final static String OFFLINE = "offline";
	public final static String INGAME = "ingame";

	public final static String EARTH = "EARTH";             //地球
	public final static String CETUS = "CETUS";             //希图斯
	public final static String VENUS = "VENUS";             //金星

	public final static Boolean ISDAY = true;               //白天
	public final static Boolean ISNIGHT = false;            //夜晚
	public final static String DAY = "白天";                //白天
	public final static String NIGHT = "夜晚";              //夜晚

	public final static String BULEPRINT = "Blueprint";     //蓝图

	private final static String sql = "SELECT * FROM StringContent";

	{
		Session session = HibernateUtils.getSessionFactory().openSession();
		SQLQuery sqlQuery = session.createSQLQuery(sql);
		List<StringContentEO> stringContentEOList = sqlQuery.addEntity(StringContentEO.class).list();
		for (StringContentEO eachEO : stringContentEOList) {
			switch (eachEO.getType()) {
				case "RIVENMODPROP":
					RIVENPROPMAP.put(eachEO.getKey(), eachEO.getValue());
					break;
				case "TIME":
					CYCLETIMESTAMP.put(eachEO.getKey(), Long.valueOf(eachEO.getValue()));
					break;
				case "ALERTS":
					ALERTSREWARD.put(eachEO.getKey(), eachEO.getValue());
					break;
				case "HIGHALERTS":
					HIGHREWARD.add(eachEO.getKey());
					break;
				case "GROUP":
					if (eachEO.getValue().equals("OPEN")) {
						SCHEDULEDGROUP.add(Long.valueOf(eachEO.getKey()));
					}
					break;
				case "WELCOME":
					WELCOME.put(eachEO.getKey(), eachEO.getValue());
					break;
				case "DEFAULTGROUPCARD":
					DEFAULTGROUPCARD.put(eachEO.getKey(), eachEO.getValue());
					break;
			}
		}
		session.close();
		System.out.println("StringContent Init Finished");
	}


}
